Integrand size = 33, antiderivative size = 177 \[ \int \frac {(a+b \sec (c+d x))^2 (A+B \sec (c+d x))}{\sqrt {\sec (c+d x)}} \, dx=\frac {2 \left (a^2 A-A b^2-2 a b B\right ) \sqrt {\cos (c+d x)} E\left (\left .\frac {1}{2} (c+d x)\right |2\right ) \sqrt {\sec (c+d x)}}{d}+\frac {2 \left (6 a A b+3 a^2 B+b^2 B\right ) \sqrt {\cos (c+d x)} \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),2\right ) \sqrt {\sec (c+d x)}}{3 d}+\frac {2 b (3 A b+5 a B) \sqrt {\sec (c+d x)} \sin (c+d x)}{3 d}+\frac {2 b B \sqrt {\sec (c+d x)} (a+b \sec (c+d x)) \sin (c+d x)}{3 d} \]
[Out]
Time = 0.30 (sec) , antiderivative size = 177, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.182, Rules used = {4111, 4132, 3856, 2720, 4131, 2719} \[ \int \frac {(a+b \sec (c+d x))^2 (A+B \sec (c+d x))}{\sqrt {\sec (c+d x)}} \, dx=\frac {2 \left (3 a^2 B+6 a A b+b^2 B\right ) \sqrt {\cos (c+d x)} \sqrt {\sec (c+d x)} \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),2\right )}{3 d}+\frac {2 \left (a^2 A-2 a b B-A b^2\right ) \sqrt {\cos (c+d x)} \sqrt {\sec (c+d x)} E\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{d}+\frac {2 b (5 a B+3 A b) \sin (c+d x) \sqrt {\sec (c+d x)}}{3 d}+\frac {2 b B \sin (c+d x) \sqrt {\sec (c+d x)} (a+b \sec (c+d x))}{3 d} \]
[In]
[Out]
Rule 2719
Rule 2720
Rule 3856
Rule 4111
Rule 4131
Rule 4132
Rubi steps \begin{align*} \text {integral}& = \frac {2 b B \sqrt {\sec (c+d x)} (a+b \sec (c+d x)) \sin (c+d x)}{3 d}+\frac {2}{3} \int \frac {\frac {1}{2} a (3 a A-b B)+\frac {1}{2} \left (6 a A b+3 a^2 B+b^2 B\right ) \sec (c+d x)+\frac {1}{2} b (3 A b+5 a B) \sec ^2(c+d x)}{\sqrt {\sec (c+d x)}} \, dx \\ & = \frac {2 b B \sqrt {\sec (c+d x)} (a+b \sec (c+d x)) \sin (c+d x)}{3 d}+\frac {2}{3} \int \frac {\frac {1}{2} a (3 a A-b B)+\frac {1}{2} b (3 A b+5 a B) \sec ^2(c+d x)}{\sqrt {\sec (c+d x)}} \, dx+\frac {1}{3} \left (6 a A b+3 a^2 B+b^2 B\right ) \int \sqrt {\sec (c+d x)} \, dx \\ & = \frac {2 b (3 A b+5 a B) \sqrt {\sec (c+d x)} \sin (c+d x)}{3 d}+\frac {2 b B \sqrt {\sec (c+d x)} (a+b \sec (c+d x)) \sin (c+d x)}{3 d}+\left (a^2 A-A b^2-2 a b B\right ) \int \frac {1}{\sqrt {\sec (c+d x)}} \, dx+\frac {1}{3} \left (\left (6 a A b+3 a^2 B+b^2 B\right ) \sqrt {\cos (c+d x)} \sqrt {\sec (c+d x)}\right ) \int \frac {1}{\sqrt {\cos (c+d x)}} \, dx \\ & = \frac {2 \left (6 a A b+3 a^2 B+b^2 B\right ) \sqrt {\cos (c+d x)} \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),2\right ) \sqrt {\sec (c+d x)}}{3 d}+\frac {2 b (3 A b+5 a B) \sqrt {\sec (c+d x)} \sin (c+d x)}{3 d}+\frac {2 b B \sqrt {\sec (c+d x)} (a+b \sec (c+d x)) \sin (c+d x)}{3 d}+\left (\left (a^2 A-A b^2-2 a b B\right ) \sqrt {\cos (c+d x)} \sqrt {\sec (c+d x)}\right ) \int \sqrt {\cos (c+d x)} \, dx \\ & = \frac {2 \left (a^2 A-A b^2-2 a b B\right ) \sqrt {\cos (c+d x)} E\left (\left .\frac {1}{2} (c+d x)\right |2\right ) \sqrt {\sec (c+d x)}}{d}+\frac {2 \left (6 a A b+3 a^2 B+b^2 B\right ) \sqrt {\cos (c+d x)} \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),2\right ) \sqrt {\sec (c+d x)}}{3 d}+\frac {2 b (3 A b+5 a B) \sqrt {\sec (c+d x)} \sin (c+d x)}{3 d}+\frac {2 b B \sqrt {\sec (c+d x)} (a+b \sec (c+d x)) \sin (c+d x)}{3 d} \\ \end{align*}
Time = 6.39 (sec) , antiderivative size = 125, normalized size of antiderivative = 0.71 \[ \int \frac {(a+b \sec (c+d x))^2 (A+B \sec (c+d x))}{\sqrt {\sec (c+d x)}} \, dx=\frac {2 \sqrt {\cos (c+d x)} \sqrt {\sec (c+d x)} \left (3 \left (a^2 A-A b^2-2 a b B\right ) E\left (\left .\frac {1}{2} (c+d x)\right |2\right )+\left (6 a A b+3 a^2 B+b^2 B\right ) \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),2\right )+\frac {b (b B+3 (A b+2 a B) \cos (c+d x)) \sin (c+d x)}{\cos ^{\frac {3}{2}}(c+d x)}\right )}{3 d} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. \(649\) vs. \(2(211)=422\).
Time = 28.48 (sec) , antiderivative size = 650, normalized size of antiderivative = 3.67
method | result | size |
default | \(-\frac {\sqrt {-\left (-2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1\right ) \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}\, \left (\frac {2 B \,a^{2} \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {-2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1}\, \operatorname {EllipticF}\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right )}{\sqrt {-2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}}-\frac {2 A \,a^{2} \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {-2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1}\, \operatorname {EllipticF}\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right )}{\sqrt {-2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}}+\frac {4 A a b \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {-2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1}\, \operatorname {EllipticF}\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right )}{\sqrt {-2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}}+\frac {2 A \,a^{2} \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {-2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1}\, \left (\operatorname {EllipticF}\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right )-\operatorname {EllipticE}\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right )\right )}{\sqrt {-2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}}+2 b^{2} B \left (-\frac {\cos \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {-2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}}{6 \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-\frac {1}{2}\right )^{2}}+\frac {\sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {-2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1}\, \operatorname {EllipticF}\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right )}{3 \sqrt {-2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}}\right )+\frac {2 b \left (A b +2 B a \right ) \sqrt {-2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}\, \left (2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right ) \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-\sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \operatorname {EllipticE}\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right ) \sqrt {2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1}\right )}{\sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} \left (2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )}\right )}{\sin \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1}\, d}\) | \(650\) |
parts | \(-\frac {2 \left (A \,b^{2}+2 B a b \right ) \left (-2 \sqrt {-2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}\, \cos \left (\frac {d x}{2}+\frac {c}{2}\right ) \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+\sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1}\, \sqrt {-2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}\, \operatorname {EllipticE}\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right )\right )}{\sqrt {-2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}\, \sin \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1}\, d}-\frac {2 \left (2 A a b +B \,a^{2}\right ) \sqrt {\left (2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right ) \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}\, \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {-2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1}\, \operatorname {EllipticF}\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right )}{\sqrt {-2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}\, \sin \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1}\, d}+\frac {2 A \,a^{2} \sqrt {\left (2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right ) \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}\, \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {-2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1}\, \operatorname {EllipticE}\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right )}{\sqrt {-2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}\, \sin \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1}\, d}-\frac {2 b^{2} B \left (-2 \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1}\, \operatorname {EllipticF}\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right ) \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right ) \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+\sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1}\, \operatorname {EllipticF}\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right )\right ) \sqrt {\left (2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right ) \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}}{3 \sqrt {-2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}\, \left (2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )^{\frac {3}{2}} \sin \left (\frac {d x}{2}+\frac {c}{2}\right ) d}\) | \(689\) |
[In]
[Out]
Result contains higher order function than in optimal. Order 9 vs. order 4.
Time = 0.11 (sec) , antiderivative size = 247, normalized size of antiderivative = 1.40 \[ \int \frac {(a+b \sec (c+d x))^2 (A+B \sec (c+d x))}{\sqrt {\sec (c+d x)}} \, dx=\frac {\sqrt {2} {\left (-3 i \, B a^{2} - 6 i \, A a b - i \, B b^{2}\right )} \cos \left (d x + c\right ) {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) + i \, \sin \left (d x + c\right )\right ) + \sqrt {2} {\left (3 i \, B a^{2} + 6 i \, A a b + i \, B b^{2}\right )} \cos \left (d x + c\right ) {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) - i \, \sin \left (d x + c\right )\right ) - 3 \, \sqrt {2} {\left (-i \, A a^{2} + 2 i \, B a b + i \, A b^{2}\right )} \cos \left (d x + c\right ) {\rm weierstrassZeta}\left (-4, 0, {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) + i \, \sin \left (d x + c\right )\right )\right ) - 3 \, \sqrt {2} {\left (i \, A a^{2} - 2 i \, B a b - i \, A b^{2}\right )} \cos \left (d x + c\right ) {\rm weierstrassZeta}\left (-4, 0, {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) - i \, \sin \left (d x + c\right )\right )\right ) + \frac {2 \, {\left (B b^{2} + 3 \, {\left (2 \, B a b + A b^{2}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{\sqrt {\cos \left (d x + c\right )}}}{3 \, d \cos \left (d x + c\right )} \]
[In]
[Out]
\[ \int \frac {(a+b \sec (c+d x))^2 (A+B \sec (c+d x))}{\sqrt {\sec (c+d x)}} \, dx=\int \frac {\left (A + B \sec {\left (c + d x \right )}\right ) \left (a + b \sec {\left (c + d x \right )}\right )^{2}}{\sqrt {\sec {\left (c + d x \right )}}}\, dx \]
[In]
[Out]
\[ \int \frac {(a+b \sec (c+d x))^2 (A+B \sec (c+d x))}{\sqrt {\sec (c+d x)}} \, dx=\int { \frac {{\left (B \sec \left (d x + c\right ) + A\right )} {\left (b \sec \left (d x + c\right ) + a\right )}^{2}}{\sqrt {\sec \left (d x + c\right )}} \,d x } \]
[In]
[Out]
\[ \int \frac {(a+b \sec (c+d x))^2 (A+B \sec (c+d x))}{\sqrt {\sec (c+d x)}} \, dx=\int { \frac {{\left (B \sec \left (d x + c\right ) + A\right )} {\left (b \sec \left (d x + c\right ) + a\right )}^{2}}{\sqrt {\sec \left (d x + c\right )}} \,d x } \]
[In]
[Out]
Timed out. \[ \int \frac {(a+b \sec (c+d x))^2 (A+B \sec (c+d x))}{\sqrt {\sec (c+d x)}} \, dx=\int \frac {\left (A+\frac {B}{\cos \left (c+d\,x\right )}\right )\,{\left (a+\frac {b}{\cos \left (c+d\,x\right )}\right )}^2}{\sqrt {\frac {1}{\cos \left (c+d\,x\right )}}} \,d x \]
[In]
[Out]